Repository navigation
Accept null data times on summaries, trigger levels and L4 snapshots (1.15.0) - #31
Merged
Merged
Conversation
…(1.14.1) Times that describe market data are the time of the data, and are null when that time is unknown: - CoinSummary.timestamp is Optional[datetime]: the time of the market data the summary is built from, not the time of the request. - TriggerLevels.as_of is Optional[str]: the block time of the newest trigger order event the map reflects, with millisecond precision. New TriggerLevels.as_of_block names that block. - WsL4Snapshot.timestamp is Optional[int]: the block time of last_block_number. A snapshot with a null time no longer fails validation and reaches on_message and on_l4_snapshot. Responses that carry these fields as before still parse. Tests cover a value, null and a missing field for each, on every venue that serves them.
0xFantomMenace
requested review from
bitmegistus and
nuttykenzo
as code owners
November 13, 2026 23:53
Times that describe market data can be null (summaries, trigger levels, order book snapshots). Released as a minor version because code that reads those fields as always present needs to handle a missing value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In an upcoming API update, a few time fields carry the time of the data instead of the time of the request, and are
nullwhen the time of the data is unknown. This release accepts those answers. Answers in today's shape parse exactly as before.CoinSummary.timestamp(get_summary()on Hyperliquid, HIP-3, HIP-4, Lighter, Lighter on Robinhood Chain)datetimeOptional[datetime]TriggerLevels.as_of(orders.trigger_levels()on Hyperliquid and HIP-3)strOptional[str]TriggerLevels.as_of_block(new)Optional[int]WsL4Snapshot.timestamp(l4_diffs,hip3_l4_diffs,spot_l4_diffs,hip4_l4_diffs,orderbook_full,hip3_orderbook_full)intOptional[int]last_block_number, in Unix millisecondsWithout this release, a
nullin these fields raisesValidationErroron the REST calls, and anl4_snapshotwith anulltime fails validation and never reacheson_messageoron_l4_snapshot.Also:
trigger_levels()docstring no longer describesas_ofas the server read time.l2_orderbook.get()docstring states that the book'stimestampis its block time as RFC 3339 UTC, orNonewhen unknown.timestamp.Tests
tests/test_nullable_times.py(43 cases): a value,nulland a missing field for each field, on every venue that serves it (five summary routes, both trigger-level routes, all six snapshot channels), plus an answer withoutas_of_block. Both handlers must receive the snapshot. Against 1.14.0's types, 32 of these fail.Full suite: 599 passed, 17 skipped (the live contract tests, which need a key).
ruffis clean on the changed files, andmypy oxarchivereports the same count as onmaster.